package com.example.studentcompetitionplatform.controller;

import com.example.studentcompetitionplatform.entity.Competitions;
import com.example.studentcompetitionplatform.entity.Registrations;
import com.example.studentcompetitionplatform.service.IGeRenXinXiService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/gerenxinxi")
public class GeRenXinXiController {
    @Resource
    private IGeRenXinXiService iGeRenXinXiService;
    //取消(删除)
    @PostMapping("/del")
    public Integer delete(@RequestBody Registrations registrations){
        iGeRenXinXiService.deleteR(registrations);
        return 1;
    }
    //分页数据查询
    @GetMapping("/page")
    public Map<String, Object> findPage(@RequestParam(value = "pageNum") Integer pageNum,
                                        @RequestParam(value = "pageSize") Integer pageSize,
                                        @RequestParam(value = "registrationId",required = false) Integer registrationId,
                                        @RequestParam(value = "userId") Integer userId
    ) {
        return iGeRenXinXiService.page(pageNum,pageSize,registrationId,userId);
    }
}
